package com.jianan.mis.data.domain.base;

import java.io.Serializable;


/**
 * This is an object that contains data related to the country table.
 * Do not modify this class because it will be overwritten if the configuration file
 * related to this class is modified.
 *
 * @hibernate.class
 *  table="country"
 */

public abstract class BaseCountry  implements Serializable {

	public static String REF = "Country";
	public static String PROP_NAME = "Name";
	public static String PROP_MATERIAL_PERIOD = "MaterialPeriod";
	public static String PROP_BASE_PRICE = "BasePrice";
	public static String PROP_ID = "Id";
	public static String PROP_REMARK = "Remark";


	// constructors
	public BaseCountry () {
		initialize();
	}

	/**
	 * Constructor for primary key
	 */
	public BaseCountry (java.lang.Integer id) {
		this.setId(id);
		initialize();
	}

	/**
	 * Constructor for required fields
	 */
	public BaseCountry (
		java.lang.Integer id,
		java.lang.String name) {

		this.setId(id);
		this.setName(name);
		initialize();
	}

	protected void initialize () {}



	private int hashCode = Integer.MIN_VALUE;

	// primary key
	private java.lang.Integer id;

	// fields
	private java.lang.String name;
	private java.math.BigDecimal materialPeriod;
	private java.math.BigDecimal basePrice;
	private java.lang.String remark;

	// collections
	private java.util.Set<com.jianan.mis.data.domain.Material> materials;



	/**
	 * Return the unique identifier of this class
     * @hibernate.id
     *  generator-class="native"
     *  column="id"
     */
	public java.lang.Integer getId () {
		return id;
	}

	/**
	 * Set the unique identifier of this class
	 * @param id the new ID
	 */
	public void setId (java.lang.Integer id) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}




	/**
	 * Return the value associated with the column: name
	 */
	public java.lang.String getName () {
		return name;
	}

	/**
	 * Set the value related to the column: name
	 * @param name the name value
	 */
	public void setName (java.lang.String name) {
		this.name = name;
	}



	/**
	 * Return the value associated with the column: material_period
	 */
	public java.math.BigDecimal getMaterialPeriod () {
		return materialPeriod;
	}

	/**
	 * Set the value related to the column: material_period
	 * @param materialPeriod the material_period value
	 */
	public void setMaterialPeriod (java.math.BigDecimal materialPeriod) {
		this.materialPeriod = materialPeriod;
	}



	/**
	 * Return the value associated with the column: base_price
	 */
	public java.math.BigDecimal getBasePrice () {
		return basePrice;
	}

	/**
	 * Set the value related to the column: base_price
	 * @param basePrice the base_price value
	 */
	public void setBasePrice (java.math.BigDecimal basePrice) {
		this.basePrice = basePrice;
	}



	/**
	 * Return the value associated with the column: remark
	 */
	public java.lang.String getRemark () {
		return remark;
	}

	/**
	 * Set the value related to the column: remark
	 * @param remark the remark value
	 */
	public void setRemark (java.lang.String remark) {
		this.remark = remark;
	}



	/**
	 * Return the value associated with the column: Materials
	 */
	public java.util.Set<com.jianan.mis.data.domain.Material> getMaterials () {
		return materials;
	}

	/**
	 * Set the value related to the column: Materials
	 * @param materials the Materials value
	 */
	public void setMaterials (java.util.Set<com.jianan.mis.data.domain.Material> materials) {
		this.materials = materials;
	}

	public void addToMaterials (com.jianan.mis.data.domain.Material material) {
		if (null == getMaterials()) setMaterials(new java.util.TreeSet<com.jianan.mis.data.domain.Material>());
		getMaterials().add(material);
	}




	public boolean equals (Object obj) {
		if (null == obj) return false;
		if (!(obj instanceof com.jianan.mis.data.domain.Country)) return false;
		else {
			com.jianan.mis.data.domain.Country country = (com.jianan.mis.data.domain.Country) obj;
			if (null == this.getId() || null == country.getId()) return false;
			else return (this.getId().equals(country.getId()));
		}
	}

	public int hashCode () {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getId()) return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}


	public String toString () {
		return super.toString();
	}


}